package com.ruoyi.client.service.impl;

import com.ruoyi.bookbus.domain.BookProduct;
import com.ruoyi.bookbus.mapper.BookProductMapper;
import com.ruoyi.client.mapper.GoodsMapper;
import com.ruoyi.client.pojo.form.GoodsQueryPageForm;
import com.ruoyi.client.pojo.vo.GoodsDetailVo;
import com.ruoyi.client.pojo.vo.GoodsVo;
import com.ruoyi.client.service.GoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("GoodsServiceImpl")
public class GoodsServiceImpl implements GoodsService {
    @Resource
    private GoodsMapper GoodsMapper; // 注入数据层的Bean

    @Resource
    private BookProductMapper bookProductMapper;

    //分页查询
    @Override
    public List<GoodsVo> queryPage(GoodsQueryPageForm form) {
        return GoodsMapper.queryPage(form);
    }

    @Override
    public GoodsDetailVo selectVoById(Long productId) {
        return GoodsMapper.selectVoById(productId);
    }

    @Override
    public BookProduct selectByPrimaryKey(Long id) {
        if (id == null) {
            return null;
        }
        return bookProductMapper.selectBookProductById(id);
    }
}
